<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href='__HOME__/css/aui.css' rel='stylesheet' />
<link href='__HOME__/images/login.css' rel='stylesheet' />
<title>登录</title>
<body>
   <div class='logo'>
      <img src='__HOME__/images/logo.png'>
   </div>
   
   <table class='login_form' align=center>
      <tr><td><img src='__HOME__/images/avatar.png' /></td><td><input type='text' placeholder='用户名' id='username' /></td></tr>
      <tr><td><img src='__HOME__/images/lock.png' /></td><td><input type='password' placeholder='密码' id='pwd' /></td></tr>
   </table>
   
   <div class='opt_btn'>
      <a href='javascript:login()'>登 录</a>
      <a href='{:url("register")}'>注 册</a>
   </div>
   <div class='forget_pwd'>
      <a >忘记密码?</a>
   </div>
   {include file="common/footer"/}
   
   <script>
      var dialog = new auiDialog({})
      function login(){
        var username = $('#username').val();
        if (!username) {
            dialog.alert({
				title:"提示",
				msg:"请填写用户名!",
				buttons:['确定']
			});
            return;
        }
        var pwd   = $('#pwd').val();
        if (!pwd) {
            dialog.alert({
				title:"提示",
				msg:"请输入密码!",
				buttons:['确定']
			});
            return;
        }

        $.post('{:url("login")}', {username:username,pwd:pwd}, function(res){
            if (res.status == 1) {
				/*dialog.alert({
					title:"提示",
					msg:res.message,
					buttons:['确定']
				}, function(){location.href = res.url;});*/
				location.href = res.url;
                
            } else {
				dialog.alert({
					title:"提示",
					msg:res.message,
					buttons:['确定']
				});
            }
        });
    }
	
	$(document).bind('keypress', function(e){
	  if(e.keyCode == 13){login();}
	});
   </script>
</body>
</html>